#!/bin/sh
#SBATCH -J subjobs # jobname
#SBATCH -p general # Partition to submit to (queue)
#SBATCH -N 1 # number of nodes, Ensure that all cores are on one machine
#SBATCH -n 1 # number of cores
#SBATCH --mem 10 # memory pool for all cores
#SBATCH -t 0-00:10 # time (D-HH:MM)
#SBATCH -o  .%N.%j.out # output file, %N name of nodelist, %j jobID

script_dir=/pine/scr/m/e/meichen/hovestdta/scripts
cd ${script_dir}

for cc in {1..30}; do
	for aa in 50 100 200; do
		for bb in 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95; do
					sed "s|nsample|${aa}|g; s|simnum|${cc}|g; s|mrate|${bb}|g"  ${script_dir}/D0002_simulation_maskRate.R > sim/d0002/d0002_${aa}_${cc}_${bb}.R;
					sbatch -o log/iter/d0002_${aa}_${cc}_${bb}.log -n 1 \
						--mem=3000 -t 1:40:00 --job-name="d_${aa}_${cc}_${bb}" \
						/nas/longleaf/apps/r/3.6.0/bin/R --vanilla --no-restore --no-save CMD BATCH \
        					sim/d0002/d0002_${aa}_${cc}_${bb}.R sim/d0002/d0002_${aa}_${cc}_${bb}.Rout;
		done
	done
done
for cc in {1..30}; do
	for aa in 300 500; do
		for bb in 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95; do
					sed "s|nsample|${aa}|g; s|simnum|${cc}|g; s|mrate|${bb}|g"  ${script_dir}/D0002_simulation_maskRate.R > sim/d0002/d0002_${aa}_${cc}_${bb}.R;
					sbatch -o log/iter/d0002_${aa}_${cc}_${bb}.log -n 1 \
						--mem=3000 -t 02:00:00 --job-name="d_${aa}_${cc}_${bb}" \
						/nas/longleaf/apps/r/3.6.0/bin/R --vanilla --no-restore --no-save CMD BATCH \
        					sim/d0002/d0002_${aa}_${cc}_${bb}.R sim/d0002/d0002_${aa}_${cc}_${bb}.Rout;
		done
	done
done